package com.sise.wangzhan;

import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Classname HealthController
 * @Description TODO 模拟数据库连接的开关
 * @Date 2020/3/19 11:10
 * @Created by wangzhan
 */
@RestController
public class HealthController {

    static Boolean canVisitDb = false;

    @RequestMapping(value = "/db/{canVisitDb}", method = RequestMethod.GET)
    public String setConnectState(@PathVariable("canVisitDb") Boolean canVisitDb){

        HealthController.canVisitDb = canVisitDb;
        System.out.println("================"+HealthController.canVisitDb+"-----------");

        return "Now database is state:"+HealthController.canVisitDb;
    }


}
